﻿
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using EpiInfoCloudMagpiBridge.Models;

namespace EpiInfoCloudMagpiBridge.Controllers
{

    [Authorize]
    public class AzureMobileServicesController : Controller
    {
        //
        // GET: /AzureMobileServices/

        [HttpGet]
        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Index(AzureMobileServiceSetting amss)
        {

            var context = new MagpiEWAVEntities();
            List<MagpiAzureMapping> magpiAzureMappingList = context.MagpiAzureMappings.ToList();

            using (var Context = new MagpiEWAVEntities())
            {

                amss.EWAVUserID = ApplicationModel.CurrentEwavUserId;
                amss.MobileServiceName = "aaaaa";

                context.AzureMobileServiceSettings.Add(amss);
                context.SaveChanges();

            }


            return View();
        }
    }
}
